package com.netty;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author CHL
 * @ClassName: RegistryRegisterInfosHandler
 * @Description: 处理receiver元数据注册
 * @date 2022/12/30 16:21
 * @Version 1.0
 */

public class RegistryRegisterInfosHandler extends SimpleChannelInboundHandler<RegistryProtocol> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, RegistryProtocol registryProtocol) throws Exception {
        if (registryProtocol != null) {
            RegistryCache.consumerHost = registryProtocol.getConsumerHost();
            RegistryCache.consumerPort = registryProtocol.getConsumerPort();
        }

        System.out.println("注册中心注册信息：" + RegistryCache.consumerPort + " ==> " + RegistryCache.consumerPort);
    }

}
